package com.example.cloud.domain.common;

import java.io.Serializable;
import java.util.Date;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;

import lombok.Data;
import lombok.experimental.Accessors;

/**
 * POJO基类
 *
 * @param <I> 主键类型
 * @author tongyufu
 */
@Accessors(chain = true)
@Data
public abstract class BaseInfo<I extends Serializable> implements Serializable {

    private static final long serialVersionUID = 1L;
    /**
     * Database Column Name: id
     * <p>
     * Database Column Remarks: 主键id
     */
    @TableId(type = IdType.AUTO)
    private I                 id;

    /**
     * Database Column Name: is_deleted
     * <p>
     * Database Column Remarks: 是否删除
     * </p>
     */
    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    private String            isDeleted;

    /**
     * Database Column Name: creator
     * <p>
     * Database Column Remarks: 创建者
     * </p>
     */
    @TableField(fill = FieldFill.INSERT)
    private String            creator;

    /**
     * Database Column Name: modifier
     * <p>
     * Database Column Remarks: 修改者
     * </p>
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String            modifier;

    /**
     * Database Column Name: gmt_created
     * <p>
     * Database Column Remarks: 创建时间
     * </p>
     */
    @TableField(fill = FieldFill.INSERT)
    private Date              gmtCreated;

    /**
     * Database Column Name: gmt_modified
     * <p>
     * Database Column Remarks: 修改时间
     * </p>
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date              gmtModified;

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
    }

}
